import axios from 'axios';


axios.defaults.baseURL = 
process.env.NODE_ENV == 'production' ? 
'https://wap.365msmk.com/' : 'http://120.53.31.103:84/';

const service = axios.create({ timeout: 5000 });


service.interceptors.request.use(
    config => {
        return config;
    },
    error => {
        console.log(error);
        return Promise.reject();
    }
);

service.interceptors.response.use(
    response => {
        if (response.status === 200) {
            return response.data;
        } else {
            Promise.reject();
        }
    },
    error => {
        console.log(error);
        return Promise.reject();
    }
);

export default service;